<?php
/*
 *   This file is part of poat.
 *
 *   poat is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   poat is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with poat.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *   Copyright (c) 2008 Sergio Gabriel Teves <gabriel.sgt at gmail.com>
 */
 
require_once(ROOT_PATH."class/files.class.php");
require_once(ROOT_PATH."class/status.class.php");
require_once(ROOT_PATH."class/user.class.php");
require_once(ROOT_PATH."class/history.class.php");
require_once(ROOT_PATH."class/project.class.php");
require_once(ROOT_PATH."class/team.class.php");

$data = $param;
$data['currentpage']=1;
$data['recperpage']=RECORD_PER_PAGE;

if (isset($data['projectid']) and $data['projectid']!="") {
	$_SESSION['projectid'] = $data['projectid'];
	$prj = new project();
	$prj->id=$data['projectid'];
	$loader->get($prj);
	$_SESSION['projectname'] = $prj->name;
}
if (SAVE_SESSION == 'true') {
	saveCookie('poat['.$CURRENT_USER->userid.'][projectid]',$_SESSION['projectid']);
	$data['fstatusid'] = $_COOKIE['poat'][$CURRENT_USER->userid]['prj'.$_SESSION['projectid']]['fstatusid'];
	$data['fuserid'] = $_COOKIE['poat'][$CURRENT_USER->userid]['prj'.$_SESSION['projectid']]['fuserid'];		
	$data['fpath'] = $_COOKIE['poat'][$CURRENT_USER->userid]['prj'.$_SESSION['projectid']]['fpath'];
	$data['forder'] = $_COOKIE['poat'][$CURRENT_USER->userid]['prj'.$_SESSION['projectid']]['forder'];
	$data['recperpage'] = $_COOKIE['poat'][$CURRENT_USER->userid]['recperpage'];
	if ($data['recperpage']==null or $data['recperpage']=="" or $data['recperpage']==0) $data['recperpage'] = RECORD_PER_PAGE;
}

$recordsperpage = array(25,50,100,250,500,1000);
$tm->assign('recordsperpage',$recordsperpage);

include(ROOT_PATH."includes/filelist.php");
array_push($applicationmenu,$tm->fetch('listmenu.tpl'));
$applicationform = $tm->fetch('listform.tpl');
$applicationform= util::cleanbreaklines($applicationform);

$function = "initUpdateForm";
$tm->assign("callfunction",$function);
$tm->assign("applicationform",$applicationform);
$content = $tm->fetch('list.tpl');

?>